(*
	sendSPortDone() -- Returns 'true' if any sending activity on the serial port is completed.

	To compile and link this file using Macintosh Programmer's Workshop,

		pascal -w sendSPortDone.p
		link -m ENTRYPOINT -o HyperCommands -rt XFCN=7033 -sn Main=sendSPortDone ¶
			sendSPortDone.p.o "{MPW}"Libraries:interface.o

	© Copyright 1987,88 by Apple Computer, Inc.

	Initial coding 9/87 by Harry R. Chesley.
*)

{$R-}

{$S sendSPortDone } 	{ Segment name must be the same as the command name. }

unit DummyUnit;

interface

uses MemTypes, QuickDraw, OSIntf, HyperXCmd;

procedure EntryPoint(paramPtr: XCmdPtr);
	
implementation

type

Str31 = String[31];

procedure sendSPortDone(paramPtr: XCmdPtr); forward;

procedure EntryPoint(paramPtr: XCmdPtr);

	begin
		sendSPortDone(paramPtr);
	end;

procedure sendSPortDone(paramPtr: XCmdPtr);

	var i: integer;

	{$I XCmdGlue.inc}

	procedure Fail(errMsg: Str255); { set theResult and quit }
		begin
			paramPtr^.returnValue := PasToZero(errMsg);
			exit(sendSPortDone);
		end;

	{$I SPortUtil.inc}

	begin
		if paramPtr^.paramCount <> 0 then Fail('parameter count is not 0');

		SetUpSPortGlobals;
		EnsureOpenPort;

		{ Check if all asynchronous activity has finished. }
		for i := 1 to MAXPARMBLKS do
			if ThisSPort.parmBlks[i]^.ioResult > noErr then
				begin
					{ If not, return false. }
					paramPtr^.returnValue := PasToZero('false');
					exit(sendSPortDone);
				end;
		{ If yes, return true. }
		paramPtr^.returnValue := PasToZero('true')
	end;
end.
